These two cases are indistinguishable.
Are they? While we seem to have wandered off the Boost territories, consider this: If B (== typeof(propB)) were defined effectively as
class B { public: void get(...); private: void set(...); friend class A; };
would that not have the effect desired? Conceptually you could use the CRTP pattern to mix A in to the instantiation of propB so that only A was a friend.
I don't think you can do this in real life with templates because gcc does not allow declaring template parameters as friends (e.g., this does not compile)
template < typename T > class X { friend T; };
I would suggest using something similar as a "password type". Tested with
MSVC 9
#include