Newer model phones have been tested to work and be compatible with both software technologies - CDMA & GSM.
T-Mobile and AT&T run their networks on GSM technology whereas Sprint & Verizon run on CDMA. Most phones are set up to work on ONE technology rather than both.
However - the iPhone 6, 6+, 6s, 6s+ and Google Nexus 5 models and Nexus 6 models are compatible with all carriers 4G LTE speeds. Newer model phones have been wired to be compatible with both technologies.
Some other devices such as the Galaxy s4 is compatible with all carriers on 2G network speeds. It can't handle 4G LTE speeds on another carrier other than its own.
For example, a Verizon iPhone 6 will work on T-Mobile and Cricket and Sprint.
Click here to see iPhone models operating on CDMA & GSM that can read both technologies
Click here to see all Google devices that can read both technologies.