Combine two power sources with higher priority for one source
Not well without a battery. Solar panels are best used with a battery.  The problem is not in the switching but it will switch too often.

The battery will help with the momentary outage such as a cloud. Ideally you only want it to switch when the sun rises and sets. 

You can use the inverter's output to power a relay with normally open (utility AC side source) and and normally closed contacts (inverter side source). When the inverter can no longer provide power the relay will will deactivate and switch the power source.  When the inverter's power is back on it will activate the relay switching back to the solar power.