This paper studies the optimal allocation policy of a coherent system with independent heterogeneous components and dependent subsystems, the systems are assumed to consist of two groups of components whose lifetimes follow proportional hazard (PH) or proportional reversed hazard (PRH) models. We investigate the optimal allocation strategy by finding out the number $k$ of components coming from Group A in the up-series system. First, some sufficient conditions are provided in the sense of the usual stochastic order to compare the lifetimes of two-parallel–series systems with dependent subsystems, and we obtain the hazard rate and reversed hazard rate orders when two subsystems have independent lifetimes. Second, similar results are also obtained for two-series–parallel systems under certain conditions. Finally, we generalize the corresponding results to parallel–series and series–parallel systems with multiple subsystems in the viewpoint of the minimal path and the minimal cut sets, respectively. Some numerical examples are presented to illustrate the theoretical findings.