A single-molecule optical transistor