template <typename T>
struct base {
    template <typename S>
    struct nested {
    };
};

template <typename T>
struct derived: base<T> {
    void foo() {
        typename base<T>::template nested<T> obj;
    }
};

int main() {
    derived<int>().foo();
}