How to declare a friend that is a member function of another not yet defined class in C++?
-
08-10-2019 - |
Question
How I declare B's constructor to be a friend of A? I tried:
class A
{
private:
A();
public:
friend B::B();
};
class B
{
public:
B();
};
Solution
replace B::
with class
;
class A
{
private:
A();
public:
friend class B;
};
class B
{
public:
B();
};
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow