If you came without calling first then friend had other plans and you ruined them. Next time call first. I never go even my family house without an invite or calling first. It's out if respect. And I prefer a phone call in advance myself.
I think all the answers are correct,call first.I do this I just let people knock and do not answer.I sit in a chair and wait for them to leave.It is my home:) I may be busy or not dressed or have someone else coming over.Best friends or not a best friend would call cause they would know how I'm.I even call my sister and my children first it is just good manners.Now if this is not the case maybe your friend feels you know where the water is and your welcome to go get a glass:) Some people do not care if they known you a long time.