Trade expenditure functions and the gains from trade