The alignment of objects to the rotation of a reference object can also be done , as Kent mentioned in a footnote, by calling the "Transform Orientation" menu entry. Click (in object mode and with transform orientation "Local" selected) on the menu entry "Object => Transform => Align to Transform Orientation". For this to work properly, all objects you want to align have to be selected and the object that serves as the reference has to selected last (so that it's the active object) before calling the menu entry.