You don’t have to cast it. It already knows it is a StaticMeshActor. In general you don’t have to cast at all if you want to adjust visibility.
Casting is only needed when you get an actor and you need to trigger a specific event or function that is specific on that actor and at that point in your logic, the logic does not know exactly what class it is.
You should be able to just “Set visibility” on the Sphere actor.