fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class A;
  5.  
  6. class B {
  7. public:
  8. void Take(A& b);
  9. };
  10.  
  11. class A {
  12. private:
  13. int x = 1;
  14. friend void B::Take(A& b);
  15. friend void take(A& b);
  16. };
  17.  
  18. void take(A& b) {
  19. cout << b.x << endl;
  20. }
  21.  
  22. void B::Take(A& b)
  23. {
  24. cout << b.x << endl;
  25. }
  26.  
  27. int main()
  28. {
  29.  
  30.  
  31. }
  32.  
Success #stdin #stdout 0s 5304KB
stdin
Standard input is empty
stdout
Standard output is empty