Infectious pathogens compete and are subject to natural selection at multiple levels. For example, viral strains compete for access to host resources within an infected host and, at the same time, compete for access to susceptible hosts within the host population. Here we propose a novel approach to study the interplay between within- and between-host competition. This approach allows for a single host to be infected by and transmit two strains of the same pathogen. We do this by nesting a model for the host-pathogen dynamics within each infected host into an epidemiological model. The nesting of models allows the between-host infectivity and mortality rates suffered by infected hosts to be functions of the disease progression at the within-host level. We present a general method for computing the basic reproduction ratio of a pathogen in such a model. We then illustrate our method using a basic model for the within-host dynamics of viral infections, embedded within the simplest susceptible-infected (SI) epidemiological model. Within this nested framework, we show that the virion production rate at the level of the cell-virus interaction leads, via within-host competition, to the presence or absence of between-host level competitive exclusion. In particular, we find that in the absence of mutation the strain that maximizes between-host fitness can outcompete all other strains. In the presence of mutation we observe a complex invasion landscape showing the possibility of coexistence. Although we emphasize the application to human viral diseases, we expect this methodology to be applicable to be many host-parasite systems.