It seems to me that the compiler (or part of the compiler) used by your IDE has a problem. I have added enough of your code to get the full program:
#include <iostream>
using namespace std;
class C2;
class C1
{
int status;
public:
void set_status(int state);
void get_status(C2 y);
};
class C2
{
int status;
public:
void set_status(int state);
friend void C1::get_status(C2);
};
void C1::set_status(int state) {
status = state;
}
void C2::set_status(int state) {
status = state;
}
void C1::get_status(C2 y)
{
if (y.status | status)
cout << " PRINT " << endl;
}
int main() {
C1 c;
C2 d;
d.set_status(1);
c.get_status(d);
}
Compiled (without errors or warnings, with default flags) with g ++ 4.9 and VC ++ 12 (also known as VC ++ 2013). Both produced: PRINTas a way out.
IDE , , , , .