Evolutionary benefits of latency in within-host HIV infection dynamics