Jonathan Mcdougall wrote:
edgekaos wrote: Sorry I was lazy just made up the sample during the post. Here is the
correct version
Please, quote the message you are answering to.
namespace MyNameSpace
{
class MyClass
{
friend class MyFriend;
This is equivalent to
friend class MyNameSpace::MyFriend;
which is clearly not what you want. You'll have to qualify it:
friend class ::MyFriend;
But note that now because the class name is qualified, it is searched
only in that scope. If it is not found, the program is ill-formed.
You'll have to declare ::MyFriend before that point:
class MyFriend;
namespace MyNameSpace
{
class MyClass
{
friend class ::MyFriend;
int member;
};
}
Jonathan