Say you have two classes A and B that live in different namespaces. How would you make A's class be a friend of B's. The obvious solution does not seem to work.
Code:
namespace a {
class b::B;
class A { friend class b::B; };
}
namespace b {
class B {
};
}
I pretty much fixed the problem with the code that I was working with by redesigning class A so that the variables were in protected space. Basically something like this
Code:
namespace a {
class A { /* allow vars to be accessed as protected */ };
}
namespace b {
class B;
class C : public A {
friend class B;
};
class B {
};
}
However, I was wondering if this was something that C++ does not allow.