Why does the compiler not recognize Node as a type? It is a private class within AVLTree [closed]

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& newKey, const V& newValue)
        : key(newKey), value(newValue), left(NULL), right(NULL), height(0)


Node* AVLTree::findParent(Node *&current, Node *& child ) {
if (current == NULL) {
    return NULL;
if (current->right == child || current->left == child) {
    return current;
} else {
    findParent(current->right, child);
    findParent(current->left, child);


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:

tests/../avltree.cpp:72:1: fatal error: unknown type name 'Node'
Node* AVLTree::findParent(Node *&current, Node *& child ) {

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?

I also tried doing AVLTree::Node, but then got this error:

AVLTree::Node* AVLTree::findParent(Node *&current, Node *& child ) {
tests/../avltree.h:20:7: note: 'AVLTree' declared here
class AVLTree


The basic issue is that the return type is parsed in the global scope, and not in the scope of the method (due to the fact that it is before the method name and its scope specifier). So you need to explicitly scope it:

AVLTree::Node* AVLTree::findParent(Node *&current, Node *& child ) {