How to pass GameObject between classes?

Hello, I am very new to coding. Before posting this question I searched internet quite a bit, but due to my programming ignorance I could not figure this out.

Assume I have 2 classes, attached to 2 different objects.
ObjectA has a serialize field with a prefab that must be attached by hand in Inspector.
In runtime I want to pass that prefab from ObjectA (or information about which prefab must be used) to ObjectB as GameObject to instantiate it later.
The problem is, that in ObjectB class I can’t “scan” ObjectA (using GetComponent, FindObjectOfType, etc) due to some other restrictions.

Is there a way to handle this, or I need to consider of using other approaches? Thanks in advance.

You need to pass the references around. For an example, make a method in the other function which takes the instance of the first script and use the gameobject from that instance. If you’re very new to coding, I suggest you first watch all the tutorials in Unity’s tutorial section instead of asking questions that have been answered many times before.