The compiler states that there's no matching function for a call, even though there is one in the prototype
<p>I'm trying to implement a binary search tree class, but the compiler is throwing errors. The bstNode.h file is here:</p>

<pre><code>template &lt;class Item, class Key&gt;
class bstNode
{
public:
    bstNode();
    bstNode(const Item&amp; init_data, const Key&amp; init_key, bstNode&lt;Item, Key&gt; *init_left, bstNode&lt;Item, Key&gt; *init_right);
    ~bstNode();
    bstNode&lt;Item, Key&gt;* tree_copy(const bstNode&lt;Item, Key&gt;*&amp; root);
private:
    Item data;
    Key key;
    bstNode* left;
    bstNode* right;
};

    template &lt;class Item, class Key&gt;
    //line 83 in the original code is below
bstNode&lt;Item, Key&gt;* bstNode&lt;Item, Key&gt;::tree_copy(const bstNode&lt;Item, Key&gt;*&amp; root)
{
    bstNode&lt;Item, Key&gt;* l_ptr;
    bstNode&lt;Item, Key&gt;* r_ptr;
    if (root == NULL) return NULL;
    l_ptr = tree_copy(root -&gt; left());
    r_ptr = tree_copy(root -&gt; right());
    return new bstNode&lt;Item, Key&gt; (root -&gt; data(), l_ptr, r_ptr);
}
</code></pre>

<p>The .h file compiles fine with an empty main function, but when I try it with the following bit of code in bstNode.cxx, it crashes, giving an error. The code is:</p>

<pre><code>    #include &lt;cstddef&gt;
#include &lt;algorithm&gt;
#include &lt;math.h&gt;
#include &lt;iostream&gt;
#include "bstNode.h"

using namespace std;

int main()
{
    bstNode&lt;int, size_t&gt;* root_ptr = NULL;
    bstNode&lt;int, size_t&gt;* copy_root_ptr = root_ptr -&gt; tree_copy(root_ptr);
    return 0;
}
</code></pre>

<p>And the error is:</p>

<pre><code>bstNode.cxx: In function ‘int main()’:
bstNode.cxx:14: error: no matching function for call to ‘bstNode&lt;int, long unsigned int&gt;::tree_copy(bstNode&lt;int, long unsigned int&gt;*&amp;)’
bstNode.h:83: note: candidates are: bstNode&lt;Item, Key&gt;* bstNode&lt;Item, Key&gt;::tree_copy(const bstNode&lt;Item, Key&gt;*&amp;) [with Item = int, Key = long unsigned int]
</code></pre>

<p>The prototype is exactly the same as the function's implementation, sans the bstNode:: so I'm not sure what's going on. I'm using the g++ compiler. Any ideas? Much appreciated, thanks.</p>

<p>EDIT: I cut down on the code to try and highlight the problem.</p>
