I have this problem:
I have class A which is friend with class B. The class A has a vector<B>. But I would like for the class B to be able to access the class A.
class A
{
friend class B;
static vector<B*> buffer;
}
Class B
{
public:
B()
{
A::buffer.push_back(this);
}
}
Is there some other way how I could automatically add the class B to the vector?
Thanks for any kind of help!