To explain on what @Peter87 said. Its because, HamFriend is not part of the class. Its just a friend of the class. It has acces to all of its members etc. You would only put Ham:: on things that belong to the class.
Declaring something as a friend means that you allow another class or function to access private members of your class.
So in your Ham class, all you are doing is saying "I want to allow the (global) function void hamFriend(Ham &sfo) to access my private members."
That's it, you are NOT actually declaring a function inside of your class.
That's why it doesn't make sense to define void Ham::hamFriend(Ham &sfo) because Ham doesn't have a function like that.
Friend xyz(...) is not a declaration, you are just giving rights to another function.
hamFriend(Ham &sfo)
&sfo means you need to pass address, right? but why do I put ham object instead?
It means that the object is passed by reference. sfo is referring to the object that you passed to the function so any changes you make to sfo will affect the object passed to the function (ham in main).
Don't confuse the & here with the operator that you use to get the address (pointer) of an object. & here is NOT an operator. It's part of the type. The & is often written closer to the type like this Ham& sfo. The meaning is the same but it more clearly shows to the reader of the code that Ham& is the type and sfo is the variable name.