title: Unresolved overloaded function type when using a template friend function
body: <p>I have a problem where I'm trying to stuff a friend function of a class template into a <code>boost::function</code>:</p>
  
  <pre><code>#include &lt;boost/function.hpp&gt;
  
  template &lt;int N&gt;
  struct Vec{
     friend
     double dot(Vec, Vec){}
  };
  
  template class Vec&lt;2&gt;; //Force multiple instantiations
  template class Vec&lt;3&gt;;
  
  int main()
  {
      boost::function&lt;double  (Vec&lt;2&gt;, Vec&lt;2&gt;)&gt; func = dot;
      double (*func1)(Vec&lt;2&gt;, Vec&lt;2&gt;) = dot;
  }
  </code></pre>
  
  <p>Neither of the two lines in <code>main</code> will compile. For the first one, GCC complains:</p>
  
  <pre><code>error: conversion from '&lt;unresolved overloaded function type&gt;' to non-scalar type 'boost::function&lt;double(Vec&lt;2&gt;, Vec&lt;2&gt;)&gt;' requested
  </code></pre>
  
  <p>The error for the second line seems even more confusing to me:</p>
  
  <pre><code>error: no matches converting function 'dot' to type 'double (*)(struct Vec&lt;2&gt;, struct Vec&lt;2&gt;)'
  testtmpl.C:6:15: error: candidates are: double dot(Vec&lt;2&gt;, Vec&lt;2&gt;)
  testtmpl.C:6:15: error:                 double dot(Vec&lt;3&gt;, Vec&lt;3&gt;)
  </code></pre>
  
  <p>I'm kind of stymied since I don't see why <code>double dot(Vec&lt;2&gt;, Vec&lt;2&gt;)</code> doesn't match.</p>
  
  <p>Any ideas as to what is happening here?</p>