Make object A parent of object b

I have a player with rigid body and a sphere am using OnCollisionEnter and want to make (player/objectA parent of sphere/objectB) , if i use the script (where tag “GameController is for player and tag"sphere” is for sphere) and attached this script to sphere the sphere becomes parent of player but when i attach this script to player, player would not becomes the parrent of sphere. Any one know how to solve this problem?

//script when attached to sphere

void OnCollisionEnter(Collision col)
{

	Debug.Log ("collision occur");
	if(col.gameObject.tag=="player")
	{
		col.transform.parent=transform;
	}
}

//script when attached to player

void OnCollisionEnter(Collision col)
{

	Debug.Log ("collision occur");
	if(col.gameObject.tag=="sphere")
	{
		col.transform.parent=transform;
	}
}

You need to switch it for the player. For the player, use this: transform.parent = col.transform;

You should also look at Unity - Scripting API: Transform.SetParent, as transform.parent is deprecated.