Aviva has agreed to buy the rival insurer Direct Line for £3.7bn, with up to 2,300 job cuts planned as the companies aim for £125m in cost savings.