Elon Musk and Donald Trump have shifted from critics to unlikely allies over the span of one election cycle.