template <class T> struct A
{
struct AA;
struct AC;
};
template <class T> class B
:public A<T>
{
friend struct B::AA; friend struct AC;
private: static T valueA_AA;
static T valueA_AC;
static T value_AC;
};
template <typename T> T B<T>::valueA_AA;
template <typename T> T B<T>::valueA_AC;template <typename T> T B<T>::value_AC;
template <class T> struct A<T>::AA
{
int M ()
{
return B<T>::valueA_AA;
}
};
template <class T> struct A<T>::AC
{
T M ()
{
return B<T>::valueA_AC; }
};
struct AC
{
int M ()
{
return B<int>::value_AC; }
};
B<int> b;
A<int>::AA a_aa;
A<int>::AC a_ac;
AC ac;
int main ()
{
a_aa.M ();
a_ac.M ();
ac.M ();
}