This can not be done purely with css. This is a behaviour, which affects the styling of the page.
With jquery you can quickly implement the behavior from your question:
$(function() {
$('#a').hover(function() {
$('#b').css('background-color', 'yellow');
}, function() {
// on mouseout, reset the background colour
$('#b').css('background-color', '');
});
});