Sump

Not worth the trouble in my opinion. You would either have drill the top tanks or purchase overflows for each. A submersible pump would be in the sump and needs to be strong enough to return the water to both tanks.

A cheaper less reliable way of connecting two tanks the same height is putting a U-tube between them and using a pump or filter that can have a hose on the output to pump water into the other tank. The U-tube will keep water levels equal if flow is not too strong. Critical to keep U-tube clear of air bubbles or debris to prevent overflow.
 
Yes an overflow and sump would work.....but its gonna be a pain!! You would need 2 overflows, 2 return pumps, and a 5g tank doesnt give you much room to "play". I wouldnt do it.
 
AquariaCentral.com