India & Sri Lanka were both in the Non-Aligned Movement and had good ties with USSR/Eastern Bloc. India was the first country where a Communist Party was elected in a bourgeois democracy system. So, Communists had significant influence on the state even if the state itself was aligned mainly with the bourgeoisie. Communism/Socialism wasn't considered a no-no word in these countries unlike the West.
and also see this article on the resistance Israel faced trying to build ties with India