What is wrong in my min method (Binary Search Tree)?
===

This is a binary search tree implementation, I cant figure out why my min method (for finding the minimum element in a tree) is not returning the correct answer, but an arbitrary memory address.
I am creating a tree by this constructor BST(3);, now I run min(), it returns correctly 3, but after inserting 1(insert(1) method), min() returns some hex address.

    class node{
        public:
        int key;
        node *left;
        node *right;
        node *parent;
    };
    class BST{
        node *root;
        public:
        BST(){}
        BST(int a){
            root=new node();
            root->left=NULL;
            root->right=NULL;
            root->parent=NULL;
            root->key=a;
        }
        void insert(int n)
        {
           if(search(n))return;
           node *p=root;
           node *m=new node;
           m->key=n;
           m->left=NULL;
           m->right=NULL;

        while(1)
        {
            if(p->key > n)
            {
                //look left
                if(p->left==NULL)
                {
                    p->left=m;
                    m->parent=p;
                    return;
                }
                else
                    p=p->left;



            }
            else
            {
                //look right
                if(p->right==NULL)
                {
                    p->right=m;
                    m->parent=p;
                    return;
                }
                else
                    p=p->right;

            }
        }
    }
    bool search(int n)
    {
        node *p=root;
        while(1)
        {
            if(p->key > n)
            {
                //look left
                if(p->left==NULL)
                    return false;

                else
                    p=p->left;



            }
            else if(p->key==n)return true;
            else
            {
                //look right
                if(p->right==NULL)
                    return false;

                else
                    p=p->right;

            }
        }

    }
    int min()
    {
        node *p=root;
        if(p->left == NULL)
        return (p->key);
        p=p->left;
    }
    };