On large ships (e.g., aircraft carriers), the executive officer (XO) may be a captain in rank, in which case it would be proper to address him by rank. Often the XO prefers to be called "XO" to avoid confusion with the CO, who is also a captain in rank and the captain of the ship.[2] The same applies to aircraft carriers in the U.S. Navy, where the commander and deputy commander of the embarked carrier air wing are both captains in rank, but are addressed by the titles of "CAG" and DCAG," respectively.
http://en.wikipedia.org/wiki/Captain_(naval)