they have agreements & settle up periodically.....same w/code shares...
in the 60's. when air tickets were like cash almost, you could get on a competitors flight w/a ticket.....a ua employee told me that the carriers had a clearing system to settle up monthly iirc...