title: Instantiating a structure defined in base class in derived class
body: <p>I have a following code where I instantiate a structure in derived class which is defined in the base class. Here is the piece of dummy code that I created which gives the same error.</p>
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  template&lt;class T&gt;
  class A
  {
      public:
      struct t {
      int a ;
  };
  
  A() { }
  
  virtual void xx () {    }
  };
  
  template&lt;class T&gt;
  class B
  {
       public:
       void xx() 
      {
          A&lt;T&gt;::t tt;
      }
  };
  
  int main() 
  {
      B&lt;int&gt; b;
      return 0;
  } 
  </code></pre>
  <p>While running the actual code I get following error at my end. identifier tt is undefined.
  If u run the above code it will give the error &quot;error: need ‘typename’ before ‘A { T }::t’ because ‘A {T}’ is a dependent scope. If I use like this A {int}::t tt  it works fine.</p>
  <p>Can someone let me know how to fix this. Why I am getting this error and why my solution is working.</p>