title: Declaring a template class as friend
body: <p>Here is an MCVE:</p>
  <pre><code>template &lt;typename T&gt;
  class A {
  public:
      friend class B;
  };
  
  template &lt;typename T&gt;
  class B {};
  
  int main() {
      A&lt;int&gt; a;
      B&lt;int&gt; b;
      return 0;
  }
  </code></pre>
  <p>Very simple thing and I dont know why this is giving compiler errors. I am new to using templates. I also tried changing the friend declaration to <code>friend class B&lt;T&gt;;</code> but that gave other errors, and did not work as well.</p>
  <p>Here is the errors that the compiler is throwing for the above code:</p>
  <pre><code>1&gt; Error    C2989   'B': class template has already been declared as a non-class template   D:\Projects\1.C++\test\test\test.cpp    8
  2&gt; Error    C3857   'B': multiple template parameter lists are not allowed  test    D:\Projects\1.C++\test\test\test.cpp    7
  3&gt; Error    C2059   syntax error: '&lt;'   test    D:\Projects\1.C++\test\test\test.cpp    12  
  </code></pre>