title: Why argument matching works for non template version, but does not work for template version?
body: <p>Consider this very simple example, where I have template wrapper class for which are defined operators:</p>
  
  <pre><code>template &lt;class T&gt;
  struct W {
     W(const T&amp;) {}
  };
  template &lt;class T&gt; 
  T operator + (const W&lt;T&gt;&amp; w1, const W&lt;T&gt;&amp; w2) { return T(); }
  </code></pre>
  
  <p>And this surprisingly cannot match for wrapped type, with simple error from gcc4.5.1 that cannot find <code>operator + (A,A)</code>:</p>
  
  <pre><code>struct A {};
  int main() {
    A a1, a2;
    A a3 = a1 + a2;
  }
  </code></pre>
  
  <p>I've tried to find the reason by testing non template wrapper, but this version works:</p>
  
  <pre><code>struct A {};
  struct WA {
     WA(const A&amp;) {}
  }; 
  A operator + (const WA&amp; w1, const WA&amp; w2) { return A(); }
  int main() {
    A a1, a2;
    A a3 = a1 + a2;
  }
  </code></pre>
  
  <p>What is the reason of such difference of arguments matching, and what to do to make template version works?</p>
  
  <p><strong>[UPDATE]</strong></p>
  
  <p>I took your answers into consideration, and I've changed the example to be a little opposite way, still with the same results - template version is complaining for missing operator +, while non template works fine. Now I have explicit cast operator to explicit wrapper class:</p>
  
  <p><strong>template version</strong></p>
  
  <pre><code>template &lt;class T&gt;
  struct W {
  };
  template &lt;class T&gt; 
  T operator + (const W&lt;T&gt;&amp; w1, const W&lt;T&gt;&amp; w2) { return T(); }
  
  struct A {
   operator W&lt;A&gt;() const { return W&lt;A&gt;(); }
  };
  </code></pre>
  
  <p><strong>not template</strong></p>
  
  <pre><code>struct WA {
  }; 
  struct A {
   operator WA() const { return WA(); }
  };
  
  A operator + (const WA&amp; w1, const WA&amp; w2) { return A(); }
  </code></pre>
  
  <p>I am trying to avoid this solution:</p>
  
  <pre><code>A a3 = W(a1) + W(a2);
  </code></pre>
  
  <p>No hope for this to work?</p>
  
  <pre><code>A a3 = a1 + a2;
  </code></pre>