title: error: no match for 'operator<<' C++
body: <p>I've looked at a few threads on stackoverflow before I thought of asking this question (since there has been a couple out there), but even through implementing some of the solutions, it doesn't seem to help my problem. That or I'm doing it wrong.</p>
  
  <p>Anyways, as it goes, the error I'm getting is:</p>
  
  <pre><code> error: no match for 'operator&lt;&lt;' in 'os &lt;&lt; itr'
  </code></pre>
  
  <p>my class is:</p>
  
  <pre><code>template &lt;typename T&gt; 
  class btree {
  
    public:
      btree(size_t maxNodeElems);
      ~btree() {}
  
      struct node {   // &lt;- this is just a declaration of a private inner-class
        list &lt;T&gt; elements;
        node *lvl;
      };
  
    private:
      size_t maxNodeElems;
      node*  root;   // &lt;- this is the actual private member
  
  };
  
  template &lt;typename T&gt;
  btree&lt;T&gt;::btree(size_t maxNodeElems) {
    if (maxNodeElems &gt; 0) maxNodeElems = maxNodeElems;
    root = new node;
    root-&gt;lvl = new node[maxNodeElems+1];
  }
  
  template &lt;typename T&gt;
  pair &lt;typename btree&lt;T&gt;::iterator, bool&gt; btree &lt;T&gt;::insert (const T&amp; elem) {
  
    root-&gt;elements.push_back(elem);
    root-&gt;elements.sort();
  
    std::pair &lt;typename btree&lt;T&gt;::iterator, bool&gt; e;
    return e;
  }
  
  template &lt;typename T&gt;
  std::ostream&amp; operator&lt;&lt;(std::ostream&amp; os, const btree&lt;T&gt;&amp; tree) {
  
    class list &lt;T&gt;::iterator itr = tree.root-&gt;elements.begin();
    for (; itr != tree.root-&gt;elements.end(); ++itr) os &lt;&lt; itr; 
  
    return os;
  }
  </code></pre>
  
  <p>I'm quite aware that my insert returns nothing, but I haven't finished implementing that function, I'm just trying to test how to get the elements out of the list at the moment. Can someone tell me what I'm doing wrong?</p>