player is the name of the class. In the name function you have to give the player parameter a name and use that instead of the class name.
1 2 3 4 5
void name(player p){
cout<<"What is your name?"<<endl;
cout<<"Name: ";
cin>>p.name;
};
On line 6 you forward declare the player class. That will allow you to have pointers and references to player objects. The name function takes player by value (not by reference) so you have to define the player class before you declare the name function. In other words, the forward declaration doesn't do anything good here.
If you changed so that the player is passed by reference it's enough to have the forward declaration before the declaration of the name function but you still need to put the definition of the player class before the definition of the name function because it is accessing the player's members.