fork download
  1. #include <memory>
  2.  
  3. struct A
  4. {
  5. protected:
  6. A() {}
  7. friend struct B;
  8. friend std::unique_ptr<A> std::make_unique<A>();
  9. };
  10.  
  11. struct B
  12. {
  13. std::unique_ptr <A> a;
  14. B() : a( std::make_unique<A>() ) {}
  15. };
  16.  
  17. int main()
  18. {
  19. B b;
  20. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Standard output is empty