Can not set a public variable of a script or gameobject in prefab

I have a prefab that has a script which needs a reference to another gameobject (public variable).
Normally i can just drag that other gameobject into the required field of the script component, but it doesn’t work.
When i use that prefab in my Hierarchy, i can assign the gameobject to the script but after hitting “Apply”, it still doesn’t change it in my prefab.

If you are editing a prefab in the Project view, you can’t specify an object in your scene in the public field of your prefab. You need to give another prefab