C# Gameobject's Script's ValuesEquals Other Gameobject's script's Values

I have two gameobjects with have the exact same script attached to both of them. I would like one of the gameobjects’s script’s values equal the other gameobjects’s script’s values. But I keep getting the error the left hand side must contain a proper indexer. What am I doing wrong?

public class SomeScript1 : MonoBehaviour {
    public gameobject someGameObject1;
    public gameobject someGameObject2;
    void Start(){
    //Both Gameobjects contain the script SomeScript2
    someGameObject1.GetComponent<SomeScript2>() = someGameObject2.GetComponent<SomeScript2>();

Instead of public gameObject why not

public SomeScript2 someScript2;

(drag/drop gameobjects containing that Components in Inspector)

and then

myVar = someScript2.myVar;