title: Why does the compiler not recognize Node as a type? It is a private class within AVLTree
body: <pre><code>class AVLTree{
      struct Node {
      K key;
      V value;
      Node* left;
      Node* right;
      int height;
  
      /**
       * Node constructor; sets children to point to `NULL`.
       * @param newKey The object to use as a key
       * @param newValue The templated data element that the constructed
       *  node will hold.
       */
      Node(const K&amp; newKey, const V&amp; newValue)
          : key(newKey), value(newValue), left(NULL), right(NULL), height(0)
      {
      }
  };
  </code></pre>
  <p>==============================================================</p>
  <pre><code>Node* AVLTree::findParent(Node *&amp;current, Node *&amp; child ) {
  if (current == NULL) {
      return NULL;
  }
  if (current-&gt;right == child || current-&gt;left == child) {
      return current;
  } else {
      findParent(current-&gt;right, child);
      findParent(current-&gt;left, child);
  }
  </code></pre>
  <p>}</p>
  <p>Trying to write a function that finds the parent of a node in an AVL Tree so I can use it in the rotation functions. However whenever I try and compile I get this error:</p>
  <pre><code>tests/../avltree.cpp:72:1: fatal error: unknown type name 'Node'
  Node* AVLTree::findParent(Node *&amp;current, Node *&amp; child ) {
  </code></pre>
  <p>Why is this happening?
  Find parent is in avltree.cpp and is listed as a private member in the AVLTree class, so what's the issue?</p>
  <p>I also tried doing AVLTree::Node, but then got this error:</p>
  <pre><code>AVLTree::Node* AVLTree::findParent(Node *&amp;current, Node *&amp; child ) {
  ^
  tests/../avltree.h:20:7: note: 'AVLTree' declared here
  class AVLTree
  </code></pre>