fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct X;
  5.  
  6. struct Y {
  7. void f(X* a);
  8. };
  9.  
  10. struct X {
  11. private:
  12. int i;
  13. public:
  14. friend void Y::f(X* a);
  15. };
  16.  
  17. void Y::f(X* x) {
  18. x->i = 0; // Error: member "X::i" (declared at line 9) is inaccessible
  19. }
  20.  
  21. int main() {
  22. // your code goes here
  23. return 0;
  24. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty