I'm trying to finish a problem for data structures where I count nodes from a node tree.

The problem is, I have to use structures for variables, and the variable types won't transfer over. This is my test program to test the function:

PHP Code:
#include<iostream>
#include "tree.h"

using namespace std;

int main()
{
    
nodeType<int> *root;
    
nodeType<int> *buddy;
    
binaryTreeType <inttest;


    
root=new nodeType<int>;
    
root->key_value=20;
    
root->left=NULL;
    
root->right=NULL;
   
    
buddy=root;
    
buddy->left=new nodeType<int>;
    
buddy->left->key_value=5;
    
buddy->left->left=NULL;
    
buddy->left->right=NULL;
    
buddy->right=new nodeType<int>;
    
buddy->right->key_value=5;
    
buddy->right->left=NULL;
    
buddy->right->right=NULL;

    
buddy=root;

    
int ctest.nodeCount(buddy); //problem occurs here

    
cout<<"The are "<<c<<" nodes in this tree"<<endl;

    
delete root;
    
delete buddy;
    return 
0;

and here is the header file:

PHP Code:
template<class elemType>
struct nodeType
{
    
int key_value;
    
nodeType<elemType> *left;
    
nodeType<elemType> *right;
    
elemType info;
    
nodeType<elemType> *llink;
    
nodeType<elemType> *rlink;
   
};

template<class elemType>
class 
binaryTreeType
{
public:
    const 
binaryTreeType<elemType>& operator=(const binaryTreeType<elemType>&);
    
bool isEmpty();
    
void inorderTraversal();
    
void preorderTraversal();
    
void postorderTraversal();
    
int treeHeight();
    
int treeNodeCount();
    
int treeLeavesCount();
    
void destroyTree();
    
binaryTreeType(const binaryTreeType<elemType>& otherTree);
    
binaryTreeType();
    ~
binaryTreeType();
protected:
    
nodeType<elemType> *root;
private:
    
void copyTree(nodeType<elemType>* &copiedTreeRootnodeType<elemType>* otherTreeRoot);
    
void destroy(nodeType<elemType>* &p);
    
void inorder(nodeType<elemType> *P);
    
void preorder(nodeType<elemType> *p);
    
void postorder(nodeType<elemType> *p);
    
int height(nodeType<elemType> *p);
    
int max (int xint y);
    
int nodeCount(nodeType<elemType> *p); //problem occurs here
    
int leavesCount(nodeType<elemType> *p);
}; 

I thought keeping the same structures variable "nodeType" would work. But it doesn't, it says this for the error:

c:\documents and settings\j\my documents\c++\lab\project 1 question 4\test3\test3\question1test.cpp(30) : error C2248: 'binaryTreeType<elemType>::nodeCount' : cannot access private member declared in class 'binaryTreeType<elemType>'
with
[
elemType=int
]
c:\documents and settings\j\my documents\c++\lab\project 1 question 4\test3\test3\tree.h(41) : see declaration of 'binaryTreeType<elemType>::nodeCount'
with
[
elemType=int
]

any help would be much appreciated, I'm so close to solving this problem.

-thanks in advance pyromonki.