Ошибка компилятора при объявлении класса-друга шаблона в пределах класса-шаблона

Я пытался реализовать свой собственный класс связанного списка для дидактических целей.

Я указал класс "List" как друга в объявлении Iterator, но он не компилируется.

Это интерфейсы 3 классов, которые я использовал:

node.h:

#define null (Node<T> *) 0

template <class T>
class Node {
 public:
    T content;
    Node<T>* next;
    Node<T>* prev;

    Node (const T& _content) :
        content(_content),
        next(null),
        prev(null)
    {}
};

Iterator.h:

#include "Node.h"

template <class T>
class Iterator {
 private:
    Node<T>* current;

    Iterator (Node<T> *);

 public:
    bool isDone () const;

    bool hasNext () const;
    bool hasPrevious () const;
    void stepForward ();
    void stepBackwards ();

    T& currentElement () const;

    friend class List<T>;
};

list.h

#include <stdexcept>
#include "Iterator.h"

template <class T>
class List {
 private:
    Node<T>* head;
    Node<T>* tail;
    unsigned int items;

 public:
    List ();

    List (const List<T>&);
    List& operator = (const List<T>&);

    ~List ();

    bool isEmpty () const {
        return items == 0;
    }
    unsigned int length () const {
        return items;
    } 
    void clear ();

    void add (const T&);
    T remove (const T&) throw (std::length_error&, std::invalid_argument&);

    Iterator<T> createStartIterator () const throw (std::length_error&);
    Iterator<T> createEndIterator () const throw (std::length_error&);
};

И это тестовая программа, которую я пытался запустить:

trial.cpp

using namespace std;
#include <iostream>
#include "List/List.cc"

int main ()
{
 List<int> myList;

 for (int i = 1; i <= 10; i++) {
  myList.add(i);
 }

 for (Iterator<int> it = myList.createStartIterator(); !it.isDone(); it.stepForward()) {
  cout << it.currentElement() << endl;
 }

 return 0;
}

Когда я пытаюсь скомпилировать его, компилятор выдает мне следующие ошибки:

Iterator.h: 26: ошибка: «Список» не является шаблоном

Iterator.h: в экземпляре «Iterator»:

trial.cpp: 18: создан здесь

Iterator.h: 12: ошибка: необходим аргумент шаблона для «списка структур»

List.cc: В функции-члене ‘Iterator List :: createStartIterator () const [with T = int]’:

trial.cpp: 18: создан здесь

Iterator.h: 14: ошибка: «Iterator :: Iterator (Node *) [с T = int]» является приватным

List.cc:120: ошибка: в этом контексте

Похоже, он не признает декларацию друга. Где я неправ?

Ответы на вопрос(2)

Ваш ответ на вопрос