Cameron pledges referendum on EU membership