Michel Barnier has urged Theresa May and Jeremy Corbyn to strike a pact keeping Britain in a customs union with the EU after Brexit.