fork(5) download
  1. #include <iostream>
  2.  
  3. struct B{};
  4. struct A{friend B*foo(B*ptr){std::cout<<"impossible";return ptr;}};
  5.  
  6. int main(){
  7. B*ptr;
  8. foo(ptr);
  9. A::foo(ptr);
  10. return 0;
  11. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:8:10: error: 'foo' was not declared in this scope
   foo(ptr);
          ^
prog.cpp:9:3: error: 'foo' is not a member of 'A'
   A::foo(ptr);
   ^
stdout
Standard output is empty