Originally Posted by
Pumplekin
Afraid not. It would need to be booked a BA codeshare ticket to count, not just be on a flight which has a codeshare.
If it is any consolation, you almost certainly wouldn't have been able to book them as BA codeshares anyway. You would only have been able to do so in conjunction with a transatlantic flight with BA (or possibly a transatlantic joint business venture airline), but not on an all North American itinerary, or connecting from Italy on AA.
You almost certainly can do that - either BA flight numbers all the way, or BA on the transatlantic flights.
OP, Iberia flights work too, so if MXP/LIN-MAD and back is cheaper (or you prefer MAD!) go for that.