This is my situation:
class foo{
public:
class bar{
friend bar operator+(const bar & , int i);
}
};
foo::bar operator+(const foo::bar & , int i){
...
}
if i compile this i get an error Undefined symbols for architecture x86_64...
so what i've done is this:
foo::bar operator+(const bar & , int i);
class foo{
public:
class bar{
friend bar operator+(const bar & , int i);
}
};
foo::bar operator+(const foo::bar & , int i){
...
}
But now is the declaration that doesn't know what is foo::bar
so i've added this:
class foo{
public:
class bar;
}
foo::bar operator+(const bar & , int i);
class foo{
public:
class bar{
friend bar operator+(const bar & , int i);
}
};
foo::bar operator+(const foo::bar & , int i){
...
}
But now is telling me that i'm redefining the class foo
, how can i solve this?
Also tried
class foo::bar;
at the beginning, but it doesn't work