Let\'s say I have 2 classes that I want to be visible (within a given header file) and one class that is their ancestor, which one I want to be visible only to the previousl
A variation of Anonymous answer, instead of private inheritance you can add private member of the hidden class.
class Hidden
{
private:
friend class Exposed;
Hidden() {}
int hidden_x;
};
class Exposed
{
public:
Exposed() {}
void DoStuff() { printf( "%d" , hidden.hidden_x ); }
private:
Hidden hidden_;
};