On the conditions tab there is a "mounted" condition, which points at any creature the hero is currently riding. You can transition from there to the other hero and make changes as necessary. Here is an example, from the Cavalier's Mounted Mastery ability:
Code:
~ get the strength bonus of our current mount
if (hero.child[pstMounted].field[pMount].ischosen <> 0) then
field[abValue3].value += hero.child[pstMounted].field[pMount].chosen.minion.child[aSTR].field[aModBonus].value
endif