I have two classes. One depends on the other class and the other one contains a function that is friend to the first class. There's a lot of other stuff in this classes but this is what it boils down to:
class LightBase;
class Color
{
friend void LightBase::UpdateColor();
};
class LightBase
{
public:
void UpdateColor();
protected:
std::vector<Color> colors_;
};
But apparently my forward declaration is not correct. I get this:
error: invalid use of incomplete type 'class LightBase'
I get that UpdateColor()
is not known by the time the friend declaration is made. But how do I fix it?