#include <iostream>

template <typename T> struct A
{
    T x;
    A(T X) : x(X) { }   
    static const A a;
};
template <typename T> const A<T> A<T>::a(5);

template <typename T> struct B : public A<T>
{
    B(T X) : A<T>(X) { }
    static const B b;
};
template <typename T> const B<T> B<T>::b(A<T>::a.x);

int main()
{
    //auto test0 = A<int>::a.x;
    auto test1 = B<int>::a.x;
    auto test2 = B<int>::b.x;
    auto test3 = A<int>::a.x;
    std::cout << "test1 = " << test1 << "\ttest2 = " << test2 << "\ttest3 = " << test3 << std::endl;

    return 0;
}