A good subnetting design will not allow addresses overlapping which is happenning in your case.The subnets 172.16.0.0/18 (not 172.16.35.0/18) and 172.16.32.0/19 (not 172.16.40.0/19) have overlapping addresses ranging from 172.16.32.1 to 172.16.63.254 which both PC1 and PC2 fall under.
You think PC1 and PC2 are in different subnets, but they don't think so by using their own algorithm.
PC1's will apply its own mask (255.255.192.0) to PC2's address (172.16.40.25) and find out it's on the same subnet(172.16.0.0/18) as its own. PC2's will apply it own mask (255.255.224.0) to PC1's address (172.16.35.20) and find out it's on the same subnet(172.16.32.0/19) as its own. That's the reason why they think they can talk to each other.
Try to change the subnet mask to 24 on both PCs, then you will have 2 totally different subnets: 172.16.35.0/24 and 172.16.40.0/24 without any overlapping addresses. You can put them on the same lan, but they will not be able to talk to each other anymore.
Hope this help