M
mrstephengross
I'm making progress on mixing templates with friends (sounds like a
drinking game, huh?). Anyway, here's the situation. I've got an "Outer"
class with a private "Inner" class (sub-class, technically). I want to
declaring an unrelated "Thing" class to be a friend of the inner class.
However, since the inner class is private, the compiler complains.
Here's what the code looks like:
====================================================
template<typename T> class Thing;
class Outer {
private:
class Inner {
public: friend class Thing<Outer::Inner>;
private: int x;
};
};
template<> class Thing<Outer::Inner> { static void go() { Outer::Inner
i; } };
======================================================
So even though the friend statement should make the Inner class
accessible to class Thing, the compiler complains that Outer::Inner is
private, and thus inaccessible. Any ideas on how to make it work?
Thanks in advance,
--Steve ([email protected])
drinking game, huh?). Anyway, here's the situation. I've got an "Outer"
class with a private "Inner" class (sub-class, technically). I want to
declaring an unrelated "Thing" class to be a friend of the inner class.
However, since the inner class is private, the compiler complains.
Here's what the code looks like:
====================================================
template<typename T> class Thing;
class Outer {
private:
class Inner {
public: friend class Thing<Outer::Inner>;
private: int x;
};
};
template<> class Thing<Outer::Inner> { static void go() { Outer::Inner
i; } };
======================================================
So even though the friend statement should make the Inner class
accessible to class Thing, the compiler complains that Outer::Inner is
private, and thus inaccessible. Any ideas on how to make it work?
Thanks in advance,
--Steve ([email protected])