title: C++ Template: 'is not derived from type'
body: <p>Why is this code not valid?</p>
  
  <pre><code>#include &lt;vector&gt;
  
  template &lt;typename T&gt;
  class A {
    public:
      A() { v.clear(); }
  
      std::vector&lt;A&lt;T&gt; *&gt;::const_iterator begin() {
        return v.begin();
      }
  
    private:
      std::vector&lt;A&lt;T&gt; *&gt; v;
  };
  </code></pre>
  
  <p>GCC reports the following errors:</p>
  
  <pre class="lang-none prettyprint-override"><code>test.cpp:8: error: type 'std::vector&lt;A&lt;T&gt;*, std::allocator&lt;A&lt;T&gt;*&gt; &gt;' is not derived from type 'A&lt;T&gt;'
  test.cpp:8: error: expected ';' before 'begin'
  test.cpp:12: error: expected `;' before 'private'
  </code></pre>
  
  <p>What is wrong?  How to fix it?</p>