Japan and the European Union have signed a wide-ranging free trade deal that both sides hope will act as a counterweight to the protectionist forces unleashed by US President Donald Trump.