title: Nested template parameters for functions
body: <pre><code>template &lt;typename T&gt; class foo2 {
  };
  </code></pre>
  
  <p>Sample 1</p>
  
  <pre><code>template &lt;typename T, template &lt;typename&gt; class foo2&gt;
  foo2&lt;T&gt; func2(){
  }
  </code></pre>
  
  <p>Sample 2</p>
  
  <pre><code>template &lt;template &lt;typename T&gt; class foo2&gt;
  foo2&lt;T&gt; func2(){
  }
  </code></pre>
  
  <p>I  have a template class and I would like to write a function that accepts only that class (with any of it's templates of course)
  why does sample 1 works and 2 does not?</p>
  
  <p>Edit:</p>
  
  <p>Please provide an explanation of how the matching happens? Clearly the function in sample 1 takes two template parameters without any default values, however in the call in the main only one parameter is provided.</p>
  
  <p>Edit2:
   I want another  func2 overload for the templated foo2 class, I already have defined in my code.</p>
  
  <pre><code>template &lt;typename T&gt;
  T func2(){
  }
  </code></pre>