fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. class Example;
  5.  
  6. class Clone
  7. {
  8. public:
  9. void f(Example);
  10. };
  11.  
  12. class Example
  13. {
  14. public:
  15. friend void Clone::f(Example);
  16. Example()
  17. {
  18. x = 10;
  19. }
  20.  
  21. private:
  22. int x;
  23. };
  24.  
  25. void Clone::f(Example ex)
  26. {
  27. std::cout << ex.x;
  28. };
  29.  
  30. int main()
  31. {
  32. Clone c;
  33. Example e;
  34. c.f(e);
  35. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
10