Britain and the European Union have agreed a draft Brexit text, including a solution to the so-called backstop to prevent a return to a hard border between Northern Ireland and Ireland.