According to the 11.8.1 paragraph of C++03 standard:
The members of a nested class have no special access to members of an enclosing class, nor to classes or functions that have granted friendship to an enclosing class
How is it possible that a single function can grant friendship to a class ?
2)
My second question concerns a base-clause of a nested class.
We can read in C++0x standard draft (11.4.2 paragraph) that:
Declaring a class to be a friend implies that the names of private and protected members from the class granting friendship can be accessed in the base-specifiers and member declarations of the befriended class. [ Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
class A
{
class B { };
friendclass X;
};
struct X : A::B //OK: A::B accessible to friend
{
A::B mx; //OK: A::B accessible to member of friend
class Y
{
A::B my; //OK: A::B accessible to nested member of friend
};
};
—end example ]
It isn't mentioned in the example whether private and protected type names from the class granting friendship can be used in the base-clause of a nested class of the friend class (here it would be the base-clause of class Y).
I think they can, do you think so too ?
I can't check it by myself since I don't have any compatible with C++0x compilers...
I'm not certain how to answer #1, but I can give you my impression of #2: I don't think that is ok, by the rule you stated in #1: that nested classes have no special access to friend classes of the enclosing class.