Canada has agreed to join the US and Mexico in a trade deal that will replace the North American Free Trade Agreement (NAFTA).