友员类的问题,为何出现那么多错误?

#include
using namespace std;

pragma once

/* ****************二叉树结点类************** */

template
class BinaryTreeNode{
friend class BinaryTree;

private:

T element; // 二叉树结点数据域
BinaryTreeNode * leftChild;//结点的左孩子结点
BinaryTreeNode * rightChild;//结点的右孩子结点
public:
BinaryTreeNode();//默认构造函数
BinaryTreeNode(const T&ele);// 给定数据域值的构造函数
BinaryTreeNode(const T& ele,BinaryTreeNode *l, BinaryTreeNode *r);// 给定数据与值与左右孩纸结点的构造函数
BinaryTreeNode * getLeftChild() const;//返回该结点的左孩子结点
BinaryTreeNode * getRightChild() const;//返回该结点的右孩子结点
void setLeftChild(BinaryTreeNode * l);//设置该结点的左孩子结点
void setRightChild(BinaryTreeNode * r);//设置该结点的右孩子结点
T getValue() const;//返回该结点的数据值
void setValue(const T& val);//设置该结点的数据域的值
bool isleaf() const;//判断该结点是否是叶子结点,若是,则返回true;
void visit(BinaryTreeNode * temp);//访问当前结点
};

ERROR:************************************************************************

Error 1 error C2059: syntax error : '<' c:\users\administrator\desktop\大二上机作业\二叉树课本习题\二叉树课本习题\binarytreenode.h 8 p141_T5
Error 2 error C2238: unexpected token(s) preceding ';' c:\users\administrator\desktop\大二上机作业\二叉树课本习题\二叉树课本习题\binarytreenode.h 8 p141_T5
Error 3 error C2989: 'BinaryTree' : class template has already been declared as a non-class template c:\users\administrator\desktop\大二上机作业\二叉树课本习题\二叉树课本习题\binarytree.h 29 p141_T5

代码不完整,看看是不是粘贴少了。

就是声明友员类的那一句,搞不明白,为什么会出现那么多错误?

还有一段:
#include
#include
#include
#include"BinaryTreeNode.h"

pragma once

/* *********************二叉树类************ */

template
class BinaryTree{

private:
BinaryTreeNode * root; // 二叉树根结点

public:
BinaryTree(); // 默认构造函数
~BinaryTree() ; // 析构函数
bool isEmpty() const; // 判定二叉树是否为空树
BinaryTreeNode * getRoot()const; // 返回二叉树根结点
BinaryTreeNode * getParent(BinaryTreeNode* current) const; //返回current节点的父节点
BinaryTreeNode * getLeftSibling(BinaryTreeNode* current) const;//返回current节点的左兄弟
BinaryTreeNode * getRightSibling(BinaryTreeNode* current) const;//返回currrent节点的右兄弟
void preOrder(BinaryTreeNode* root); //先序遍历以root为根节点的子树
void inOrder(BinaryTreeNode * root); //中序遍历以root为根节点的子树
void postOrder(BinaryTreeNode* root); //后序遍历以root为根节点的子树
void levelOrder(BinaryTreeNode* root); //按层次遍历以root为根节点的子树(广度优先遍历算法)
void deleteBinaryTree(BinaryTreeNode* root);//删除以root为根节点的子树
void isCompleteBinaryTree(BinaryTreeNode* pointer); //判断一个树是否为完全二叉树
void creat(); //创建一个完全二叉树
};
template
BinaryTree::BinaryTree(){ // 默认构造函数

root=NULL;

}
template
BinaryTreeNode* BinaryTree::getRoot()const{// 返回二叉树根结点

return root;

}
template
void BinaryTree::creat(){ //创建一个完全二叉树
BinaryTreeNode* temp_root;//暂时亲本
BinaryTreeNode* pointer; //当前指针
queue*> nodeQueue;//用队列来存放暂时亲本
pointer=new BinaryTreeNode; //开辟根节点的空间
root=pointer;
temp_root=pointer;
// pointer->element=NULL;
T i;
int flag=0; //作为根节点的输入数据标记
nodeQueue.push(temp_root); //将根节点移入队列

while((temp_root->leftChild==NULL||temp_root->rightChild==NULL)){

    if(temp_root->leftChild==NULL){

                    pointer=new BinaryTreeNode<T>;//如果左孩子为空,开辟空间
                    cin>>i;
                    if(flag==0){    //第一次输入数据,赋值给原来开辟的根节点的空间
                        root->element=i;
                        flag=1;
                    }
                    else{           //正常进行输入时,临时亲本的左子树为空,就把把开辟的空间连接到其左子树上
                    pointer->element=i;
                    temp_root->leftChild=pointer;//将开辟的空间的地址,赋值给临时亲本的左孩子
                    nodeQueue.push(pointer);//将左孩子入队
                    }
    }
    else if(temp_root->rightChild==NULL){
                    pointer=new BinaryTreeNode<T>;//如果右孩子为空,开辟空间
                    cin>>i;
                    pointer->element=i;
                    temp_root->rightChild=pointer;
                    nodeQueue.push(pointer);
    }
    if(temp_root->leftChild!=NULL&&temp_root->rightChild!=NULL){//临时亲本的左右孩子都不为空
        nodeQueue.pop();//队头出队
        temp_root=nodeQueue.front->num;//将新的队头,赋值给临时亲本
    }
                if(getchar()=='\n')break;//用户输入数据遍历完毕,跳出循环
}

}