Superconductivity and ferromagnetism: mechanisms of interaction and coexistence in a two-band model