title: Returning a class member struct with a templated class
body: <p>I'm trying to create a function that returns a class-defined struct from a templated class. g++ give the error message <code>error: expected constructor, destructor, or type conversion before ‘*’ token</code>. Here is the relevant code:</p>
  
  <p>From BSTDict.cpp:</p>
  
  <pre><code>Node*&amp; BSTDict&lt;T, Compare&gt;::add_helper(Node*&amp; r, T key) { ... }
  </code></pre>
  
  <p>From BSTDict.hpp:</p>
  
  <pre><code>struct Node {
      T key;
      T data;
      Node* left;
      Node* right;
  };
  
  ...
  
  Node*&amp; add_helper(Node*&amp; r, T key);
  </code></pre>
  
  <p>I've done a lot of testing and I think the problem lies with Node (regardless of the reference and pointer). I've tried <code>BSTDict&lt;T, Compare&gt;::Node*&amp; BSTDict&lt;T, Compare&gt;::add_helper(Node*&amp; r, T key) { ... }</code> too. Any help would be appreciated. Thanks.</p>
  
  <p>Edit: Here are <a href="http://pastebin.com/SVj61nka" rel="nofollow">BSTDict.hpp</a> and <a href="http://pastebin.com/NaerC8Fc" rel="nofollow">BSTDict.cpp</a>. They are part of a larger program.</p>