China and Brazil have struck a deal to conduct trade transactions in their national currencies, ditching the US dollar as an intermediary.