In the game called geo-politics, this is usual. India was in USSR camp during cold war and it needs some check and hence Pakistan is supported by India. China wants to contain India and hence it supports Pakistan to keep India in check. At present US needs Pakistan just for its proximity to Afghanistan and its ease to be controlled. But in other terms US had tilted towards India at the present time. US is losing its interest and patience on Pakistan. For your information US and China fought against Japan in the world war. Now US and Japan are allies and are against China. Self interest matters, rest are subject to change for convenience.