title: Nested class does not name a type
body: <p>Getting an error in g++ <code>List.cc:19:1: error: âIteratorâ does not name a type
  </code> when . Header is the following</p>
  
  <pre><code>class List {
  private:
  class Element {
   public:
    char data;
    Element *next;
    Element *prev;
    Element(Element *n,Element *p, char d);
  };
  Element *first;
  
  public:
  class Iterator {
   public:
    Iterator();
    void operator++();
    void operator--();
    char&amp; operator*();
    const char&amp; operator*() const;
    bool operator==(const Iterator&amp; itr);
    bool operator!=(const Iterator&amp; itr);
   private:
    Iterator(const Element&amp; ele);
    Iterator *it;
  };
  List();
  ~List();
  Iterator&amp; begin() const;
  Iterator&amp; end() const;
  void insert(Iterator itr, char c);
  void erase(Iterator itr);
  
  };
  </code></pre>
  
  <p>Line 19 is:</p>
  
  <pre><code>Iterator&amp; List::begin() const
  </code></pre>
  
  <p>Is this an inheritance issue? I am trying to call iterator in the main function just like a std::list via List::Iterator</p>