I am trying to learn Swift 4 generics and have written some code that won't compile. I don't understand why. Here's the code:

```
protocol NodeType {
    associatedtype T
    associatedtype E
    var parent: T {get set}
    var children: [T] {get set}
    var item: E {get set}
    func getItem()->E
    mutating func setItem(_ newItem: E)
    func getParent()->T
    mutating func setParent(_ theParent:T)
    func getChild(at index:Int)->T
    mutating func insertChild(at index:Int, child: T)
    func find(_ node:T)->Int
}

protocol ItemType:Equatable {
    associatedtype E
    var payload: E {get set}
    func matches(_ item:E)->Bool
}

struct Item<E:Equatable>: ItemType {
    var payload: E
    func matches(_ item: E) -> Bool {
        return payload == item
    }
}

struct Node<T:NodeType, E:ItemType>: NodeType {
    var parent: T
    var children: [T]
    var item: E

    func getItem()->E {
        return item
    }

    func find(_ node: T) -> Int {
        for aNode in children {
            // ********************************************************************
            // the following line fails: Value of type 'T.E' has no member 'matches'
            if aNode.getItem().matches(node) {
            }
        }
    }

    mutating func setItem(_ newItem: E) {
        item = newItem
    }

    func getParent()->T {
        return parent
    }

    mutating func setParent(_ theParent:T) {
        parent = theParent
    }

    func getChild(at index:Int)->T {
        precondition(0..<children.count ~= index)
        return children[index]
    }

    mutating func insertChild(at index:Int, child: T) {
        precondition(0...children.count ~= index)
        if index == children.count {
            // append at end
            children.insert(child, at: children.endIndex)
        }
        else {
            children.insert(child, at: index)
        }
    }
}

```

My understanding is that aNode has type T constrained to NodeType and aNode.getItem() is type E constrained to ItemType, which contains the function matches. Can someone tell me where I'm going wrong.