How can I use a private inner class as a parameter in a template specialization?

  access-specifier, c++, friend, templates

While trying to get some old software to compile with clang, I encountered some code similar to the following:

class OuterClass {
  template <class T>
  class InnerClass {};

template <class T>
class OtherClass {};

template <class T>
class OtherClass<OuterClass::InnerClass<T>> {};

My understanding of this code is that the template class OtherClass is specialized for instantiations of the private inner template class OuterClass::InnerClass.

g++-10 (version 10.2.0) seems to compile this code without any errors or warnings, but clang++-10 (version 10.0.0) complains that "'InnerClass' is a private member of 'OuterClass'" at the template specialization.

Of course, I could make InnerClass public, but, since InnerClass is private in the original code, I think this solution would not be ideal. Is there a way I could allow InnerClass to be used in the specialization of OtherClass only (perhaps with some clever use of friend)?

Source: Windows Questions C++