A Market Mechanism for Trading Flexibility Between Interconnected Electricity Markets