class A {
int x;
friendstaticint B::DoIt(A& a);
friendint DoIt2(A& a);
};
class B {
staticint DoIt(A& a);
};
int B::DoIt(A& a) {
return a.x; //can't access a.x
}
int DoIt2(A& a) {
return a.x;
}
It's easy to declare DoIt2 as a friend of A, but how do I declare B::DoIt(A& a) as a friend of A? I can't seem to find the right syntax for doing it.
class A;
class B {
public:
staticint DoIt(A& a);
};
class A {
int x;
friendint B::DoIt(A& a);
friendint DoIt2(A& a);
};
int B::DoIt(A& a) {
return a.x;
}
int DoIt2(A& a) {
return a.x;
}