Add cast methods of TDirectory-like types.