How do friend classes interact with each other
<p>I have two simple class that I made just to understand how friend class works. I am confused as to why this doesn't compile and also would the Linear class have access to the struct inside Queues class?</p>

<p>Linear.h</p>

<pre><code>template&lt;typename k, typename v &gt;
 class Linear
 {
    public:
    //Can I create a instance of Queues here if the code did compile? 

    private:
  };
</code></pre>

<p>Linear.cpp</p>

<pre><code>#include "Linear.h" 
</code></pre>

<p>Queues.h</p>

<pre><code> #include "Linear.h"

 template&lt;typename k, typename v &gt;
 class Linear;

  template&lt;typename x&gt;
  class Queues
  {
    public:

    private:
        struct Nodes{
            int n;
        };
    //Does this mean I am giving Linear class access to all of my Queues class variable or    is it the opposite ? 
    friend class Linear&lt;k,v&gt;;
    };
</code></pre>

<p>Queues.cpp</p>

<pre><code>  #include"Queues.h" 
</code></pre>

<p>My errors are </p>

<pre><code>Queues.h:15: error: `k' was not declared in this scope
Queues.h:15: error: `v' was not declared in this scope
Queues.h:15: error: template argument 1 is invalid
Queues.h:15: error: template argument 2 is invalid
Queues.h:15: error: friend declaration does not name a class or function
</code></pre>
