The A380 might have been a commercial failure when seen as an isolated product line. I suspect, but haven't seen a detailed analysis, of whether it still wasn't a net profit for Airbus considering it pulled in previous Boeing customers, locked in additional sales in A330/340 and A32x because of training commonality, furthered integration of Airbus and pioneered technologies for the A350 and A32x Neo.
One could also argue that the A350 is a B787 done right, learning from both the B787 and A380's mistakes as well as gains.
Indeed. I once saw analyses of the A380 that indicated it succeeded because:
1) By simply existing as an alternative to the B747 it stopped Boeing pushing the B747 prices up and thereby killed a cash-cow for Boeing;
2) Again, by simply existing, it stopped Boeing doing the co-sell of the 737/etc along with the 747 and in-extremis threatening to block 747 sales unless the co-sells were done;