fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class B;
  5.  
  6. class A
  7. {
  8. friend B::B(A &);
  9. //friend class B;
  10. public:
  11. A(B &b);
  12. };
  13.  
  14. class B
  15. {
  16. friend A::A(B &);
  17. public:
  18. B(A &a);
  19. };
  20.  
  21. int main() {
  22. // your code goes here
  23. return 0;
  24. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:8:17: error: invalid use of incomplete type ‘class B’
  friend B::B(A &);
                 ^
prog.cpp:4:7: error: forward declaration of ‘class B’
 class B;
       ^
stdout
Standard output is empty