How do I set a class if entry is a child of a particular parent?
If you want to test whether entry-with-id-X is an ancestor of entry, do this (assuming x = 13):

{% set entryWithIdX = craft.entries.id(13).first() %}
...
{% if entryWithIdX.isAncestorOf(entry) %} ... {% endif %}
{# or #}
{% if entry.isDescendantOf(entryWithIdX) %} ... {% endif %}


isAncestorOf and isDescendantOf take an entry as parameter, not an entryId.

It would be a good idea to test to see whether craft.entries.id(13) returns anything before calling first() on it, but that's a separate issue.